/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.IOException;
import java.net.URL;
import java.util.Properties;

/**
 * Maybe we should use pattern Singleton /**********************************
 * 
 * @author pyty
 */
public class DBConfig {
    private Properties props = new Properties();

    public DBConfig()  {
        URL url = ClassLoader.getSystemResource(Config.DB_FILE);
        try {
            props.load(url.openStream());
        } catch (IOException ex) {
            throw new RuntimeException("Error opening DB config file", ex);
        }
    }
    
    public String getDbUrl() {
        return props.getProperty("dburl");
    }
    
    public String getDbUser() {
        return props.getProperty("dbuser");
    }
    
    public String getDbPass() {
        return props.getProperty("dbpass");
    }
    
    public String getDbDriver() {
        return props.getProperty("dbdriver");
    }
}
